package situ.autoweter.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import situ.autoweter.service.BeFormulaService;
import situ.autoweter.entity.BeFormula;
import java.util.*;
/**
 * BeFormula的路由接口服务
 * 
 * @author 胡文
 *
 */
@Controller
public class BeFormulaController {

	/** BeFormulaService服务 */
	@Autowired
	private BeFormulaService beFormulaService;
	
	/**
	 * 查询所有BeFormula数据的方法
	 * @param value
	 * @return
	 */
	@RequestMapping(value = "queryBeFormula", produces = {"application/json;charset=UTF-8"})
	public String find(BeFormula value,Map map) {
		 List<BeFormula> list= beFormulaService.find(value);
         map.put("items",list);
         return "页面名称自己改";
	}
	
	/**
	 * 通过id查询BeFormula数据的方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "queryBeFormulaById/{id}", produces = {"application/json;charset=UTF-8"})
	public String findOne(@PathVariable(name="id") Object id,Map map) {
        BeFormula obj=  beFormulaService.findOne(id);
        map.put("BeFormula",obj);
        return "页面名称自己改";
	}
	
	/**
	 * 插入BeFormula属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "saveBeFormula", produces = {"application/json;charset=UTF-8"})
	public String save(BeFormula value) {
		  beFormulaService.saveNotNull(value);
        return "redirect:/queryBeFormula";
	}
	
	/**
	 * 更新BeFormula属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "updateBeFormula", produces = {"application/json;charset=UTF-8"})
	public String update(BeFormula value) {
		  beFormulaService.updateNotNullById(value);
          return "redirect:/queryBeFormula";
	}
	
	/**
	 * 通过id删除BeFormula数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "delBeFormulaById/{id}", produces = {"application/json;charset=UTF-8"})
	public String delete(@PathVariable(name="id") Object id) {
		  beFormulaService.deleteById(id);
          return "redirect:/queryBeFormula";
	}
}
